import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({

  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
      "_c": resolve(__dirname, "./src/components/")
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
      }
    }
  },
  plugins: [vue()],
  build: {
    outDir: resolve(__dirname, 'cy-comp/dist'),
    lib: {
      entry: resolve(__dirname, 'src/components/index.js'), // 组件库入口文件
      name: 'index',
      fileName: (format) => `index.${format}.js`
    },
    rollupOptions: {
      // 确保外部化处理那些你不想打包进库的依赖
      external: ['vue'],
      output: {
        // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
        globals: {
          vue: 'Vue'
        }
      }
    }
  },
  server: {
    port: 5178,
    open: false,
    hmr: true,
    https: false,
    host:'0.0.0.0',
    proxy: {
      '/rl-baisha': { // 服务器
        target: "http://10.0.240.32",
        changeOrigin: true,
        logLevel: "debug"

      },
      '/whisper/asr': { // 服务器
        target: "http://114.242.71.202:8087",
        changeOrigin: true,
        logLevel: "debug"

      },
      '/api': { // 服务器
        target: "http://10.0.240.33:11434",
        changeOrigin: true,
        logLevel: "debug"

      },
      '/tts': { // 服务器
        target: "http://10.0.116.193:9966/",
        changeOrigin: true,
        logLevel: "debug"

      },
    }
  }
})
